package com.ccrfid.rmc6.repository.sys;

import com.ccrfid.rmc6.entity.sys.LocationPersonnelActivityEntity;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.query.Param;

import java.sql.Timestamp;
import java.util.List;

public interface LocationPersonnelActivityRepository extends Repository<LocationPersonnelActivityEntity, Long> {

    @Query("select t from LocationPersonnelActivityEntity t where t.personnelType = :pt and t.locationType = :lt " +
            "and (:tm between t.startTime and t.stopTime)")
    List<LocationPersonnelActivityEntity> getActivityEntity(@Param("pt") Integer personnelType,
                                                            @Param("lt") Integer locationType,
                                                            @Param("tm") Timestamp timestamp);
}
